package sepe.chenli.unit4.task4_3;
public class HireUserDAOImp implements UserDAO {
    private static HireUser[] hu = new HireUser[2];

    public HireUserDAOImp() {
        for (int i = 0; i < hu.length; i++) {
            hu[i] = new HireUser();
            hu[i].setUserID(i + 1);
        }
    }

    public static boolean isExist(HireUser hireUser, int userID) {
        boolean flag = false;
        for (int i = 0; i < hu.length; i++) {
            if (hu[i].getUserID(userID) == hireUser.getUserID(userID)) {
                flag = true;
                break;
            }
        }
        return flag;

    }
    public void inserUser(HireUser hireUser){
         int length=hu.length;
         if(hireUser instanceof  HireUser){
             HireUser[]h=hu;
             hu=new HireUser[length+1];
             for(int i=0;i<h.length;i++){
                 hu[i]=h[i];
             }
             hu[length]=hireUser;
         }else{
             System.out.println("求租客户信息对象错了！");
         }
    }


    @Override
    public boolean isEixist(User u) {
        return false;
    }

    @Override
    public void insertUser(User u) {

    }
}